#include<iostream>
#include<vector>
using namespace std ; 
typedef long long ll ; 
ll rd(){
	ll a = 0 ; 
	scanf("%lld",&a);
	return a ; 
} 
int main(){
	ll n = rd() , k  = rd(); 
	vector<ll> is(n+k+1) ;
	vector<ll> sum(n+k+1) ; 
	ll ans = 0 ; 
	for(int i = 0 ; i < n ; i++){
		int j = i + k ; 
		sum[j] = is[j] = rd() ; 	
		sum[j] += sum[j-1];
		if(i>k)sum[j] -= is[j-k-1] ; 
		ans = ans > sum[j] ? ans : sum[j] ; 
	}
	printf("%lld" , ans) ; 
	return 0 ; 
}